package com.buding.fx.dao.impl;

import com.buding.fx.dao.MenuDao;
import com.buding.fx.entity.Menu;
import com.buding.fx.utils.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class MenuDaoImpl implements MenuDao {


    @Override
    public List<Menu> selectAll() {
        List<Menu> list = null;
        SqlSession session = null;
        try {
             session = MyBatisUtil.getSqlSession();
            MenuDao mapper = session.getMapper(MenuDao.class);
            list = mapper.selectAll();
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            if (session!=null){
                session.close();
            }
        }
        return list;
    }
}
